//
//  VipSelevtButton.m
//  Shengzhuli
//
//  Created by FXGuo on 2017/7/26.
//  Copyright © 2017年 kamangkeji. All rights reserved.
//

#import "VipSelevtButton.h"

@interface VipSelevtButton ()

@property (nonatomic,weak) UILabel *subLab;

@end

@implementation VipSelevtButton

- (void)awakeFromNib
{
    [super awakeFromNib];
    UILabel *subLab = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, self.width, 20)];
    subLab.textAlignment = NSTextAlignmentCenter;
    subLab.textColor = [UIColor whiteColor];
    subLab.font = Font(11);
    self.subLab = subLab;
    [self addSubview:subLab];
}
- (void)setSubTitle:(NSString *)subTitle
{
    _subTitle = subTitle;
    self.subLab.text = subTitle;
}
- (void)setSelected:(BOOL)selected
{
    [super setSelected:selected];
    if (selected) {
        self.backgroundColor = RGBColorOne(51);
        self.subLab.textColor = [UIColor whiteColor];
    }else {
        self.backgroundColor = [UIColor whiteColor];
        self.subLab.textColor = [UIColor blackColor];
    }
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.titleLabel.center = CGPointMake(self.centerX, self.centerY-25);
    self.titleLabel.width = self.width;
    self.titleLabel.x = 0;
    self.titleLabel.textAlignment = NSTextAlignmentCenter;
    self.subLab.frame = CGRectMake(0, self.centerY-15, self.width, 20);
}

@end
